< previous page page_271 next page >

Page 271
are used to create database applications. Each bound control is connected to a Data control and to a single field in the recordset specified by the Data control. The bound control automatically displays the data in the specified field for the current record. As you use the navigation buttons to move from one record to another, the data in the bound controls are updated to reflect the current record.
However, the bound controls aren't limited to displaying the data in the recordthey can also be used to modify the data. This is done by editing the contents of the control; then, when the current record is changed or the form is closed, the data in the database is automatically updated to reflect the changes.
Note
Only controls with an editable area can be used to update data.

Programmed Access with the Data Control
To manipulate the data accessed by a Data control, you would add code to the events for the Data control and possibly for the bound controls. Some ways that you can use code with the Data control are as follows:
8694cbadb9b1ef7075903f6f95fc1db2.gif
Changing the properties of the Data control or the bound controls during program execution
8694cbadb9b1ef7075903f6f95fc1db2.gif
Providing capabilities that the Data control doesn't have by using the recordset methods
Like any other control, you can change the properties of the Data control and bound controls at runtime. You can choose to change the Connection or RecordSource properties of the Data control to set specific conditions on the data that users want to see. This can take the form of filters or sort orders, or your application might have the filters set as part of an access control scheme.
If you need to set the properties at runtime, simply set the properties with code:
DtaMyDatabase.RecordSource = Select * from Titles
DtaMyDatabase.ReQuery
After setting the properties, use the Data control's Requery method to apply the changes, as shown in the last line of the code. The changes to the Data control take effect only after the Requery method is invoked.

 
< previous page page_271 next page >

If you like this book, buy it!